<?php defined('BASEPATH') or exit('No direct script access allowed'); ?>
<?php $this->load->view('bm/common/header'); ?>
<body>
<!-- 头部 -->
<?php $this->load->view('bm/common/top'); ?>
<!-- /头部 -->

<!-- 边栏 -->
<?php $this->load->view('bm/common/sidebar'); ?>
<!-- /边栏 -->

<!-- 内容区 -->
<div id="main-content">
	<div id="top-alert" class="fixed alert alert-error" style="display: none;">
		<button class="close fixed" style="margin-top: 4px;">&times;</button>
		<div class="alert-content">这是内容</div>
	</div>
	<div id="main" class="main">

		<!-- nav -->
		<!-- nav -->


		<div class="main-title">
			<h2>新增分类</h2>
		</div>
		<div class="tab-wrap">
			<ul class="tab-nav nav">
				<li data-tab="tab1" class="current"><a href="javascript:void(0);">基 础</a></li>
				<li data-tab="tab2"><a href="javascript:void(0);">高 级</a></li>
			</ul>
			<div class="tab-content">
				<form action="" method="post" class="form-horizontal">
					<!-- 基础 -->
					<div id="tab1" class="tab-pane in tab1">
						<div class="form-item">
							<label class="item-label">上级分类<span class="check-tips"></span></label>
							<div class="controls">
								<select name="upid" >
									<option value="">无上级</option>
									<?php echo $tree_to_select;?>
								</select>
							</div>
						</div>
						<div class="form-item">
							<label class="item-label">
								<em class="must">*</em>分类名称<span class="check-tips">（名称不能为空）</span>
							</label>
							<div class="controls">
								<input type="text" name="title" class="text input-large" value="">
							</div>
						</div>
						<div class="form-item">
							<label class="item-label">
								<em class="must">*</em>分类标识
							</label>
							<div class="controls">
								<input type="text" name="name" class="text input-large" value="">
							</div>
						</div>
						<div class="form-item">
							<label class="item-label">
								<em class="must">*</em>发布内容
							</label>
							<div class="controls">
								<label class="inline radio"><input type="radio" name="allow_publish" value="0">不允许</label>
								<label class="inline radio"><input type="radio" name="allow_publish" value="1" checked>仅允许后台</label>
								<label class="inline radio"><input type="radio" name="allow_publish" value="2">允许前后台</label>
							</div>
						</div>
						<div class="form-item">
							<label class="item-label">
								<em class="must">*</em>是否审核<span class="check-tips">（在该分类下发布的内容是否需要审核）</span>
							</label>
							<div class="controls">
								<label class="inline radio"><input type="radio" name="check" value="0" checked>不需要</label>
								<label class="inline radio"><input type="radio" name="check" value="1">需要</label>
							</div>
						</div>
						<div class="form-item">
							<label class="item-label"><em class="must">*</em>绑定文档模型</label>
							<div class="controls">
							<?php foreach ($model_list as $value) {?>
								<label class="checkbox"><input type="radio" name="model" value="<?php echo $value['id'];?>" checked><?php echo $value['title'];?> </label>
							<?php }?>
							</div>
						</div>
						<div class="form-item">
							<label class="item-label"><em class="must">*</em>允许文档类型</label>
							<div class="controls">
								<label class="checkbox">
									<input type="checkbox" name="type[]" value="2">主题 </label><label class="checkbox">
									<input type="checkbox" name="type[]" value="1">目录 </label><label class="checkbox">
									<input type="checkbox" name="type[]" value="3">段落 </label></div>
						</div>
					</div>

					<!-- 高级 -->
					<div id="tab2" class="tab-pane tab2">
						<div class="form-item">
							<label class="item-label">可见性<span class="check-tips">（是否对用户可见，针对前台）</span></label>
							<div class="controls">
								<select name="display">
									<option value="1">所有人可见</option>
									<option value="0">不可见</option>
									<option value="2">管理员可见</option>
								</select>
							</div>
						</div>
						<div class="form-item">
							<label class="item-label">
								回复<span class="check-tips">（是否允许对内容进行回复，需要详情页模板支持回复显示与提交）</span>
							</label>
							<div class="controls">
								<label class="inline radio"><input type="radio" name="reply" value="1"
																   checked>允许</label>
								<label class="inline radio"><input type="radio" name="reply" value="0">不允许</label>
							</div>
						</div>
						<div class="form-item reply hidden">
							<label class="item-label">回复绑定的文档模型</label>
							<div class="controls">
								<label class="checkbox">
									<input type="checkbox" name="reply_model[]" value="2">文章文档 </label><label
										class="checkbox">
									<input type="checkbox" name="reply_model[]" value="3">下载文档 </label></div>
						</div>
						<div class="form-item">
							<label class="item-label">
								排序<span class="check-tips">（仅对当前层级分类有效）</span>
							</label>
							<div class="controls">
								<input type="text" name="sort" class="text input-small" value="0">
							</div>
						</div>
						<div class="form-item">
							<label class="item-label">
								列表行数
							</label>
							<div class="controls">
								<input type="text" name="list_row" class="text input-small" value="10">
							</div>
						</div>

					</div>

					<!-- 高级 -->
					<div id="tab2" class="tab-pane tab2">
						<div class="form-item">
							<label class="item-label">网页标题</label>
							<div class="controls">
								<input type="text" name="meta_title" class="text input-large" value="">
							</div>
						</div>
						<div class="form-item">
							<label class="item-label">关键字</label>
							<div class="controls">
								<label class="textarea input-large">
									<textarea name="keywords"></textarea>
								</label>
							</div>
						</div>
						<div class="form-item">
							<label class="item-label">描述</label>
							<div class="controls">
								<label class="textarea input-large">
									<textarea name="description"></textarea>
								</label>
							</div>
						</div>
						<div class="form-item">
							<label class="item-label">频道模板</label>
							<div class="controls">
								<input type="text" name="template_index" class="text input-large" value="">
							</div>
						</div>
						<div class="form-item">
							<label class="item-label">列表模板</label>
							<div class="controls">
								<input type="text" name="template_lists" class="text input-large" value="">
							</div>
						</div>
						<div class="form-item">
							<label class="item-label">详情模板</label>
							<div class="controls">
								<input type="text" name="template_detail" class="text input-large" value="">
							</div>
						</div>
						<div class="form-item">
							<label class="item-label">编辑模板</label>
							<div class="controls">
								<input type="text" name="template_edit" class="text input-large" value="">
							</div>
						</div>
					</div>

					<div class="form-item">
						<input type="hidden" name="id" value="">
						<input type="hidden" name="pid" value="">
						<button type="submit" id="submit" class="btn submit-btn" target-form="form-horizontal">确 定</button>
						<button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
					</div>
				</form>
			</div>
		</div>

	</div>
	<?php $this->load->view('bm/common/copyright'); ?>
</div>
<!-- /内容区 -->
<script type="text/javascript">
	(function () {
		var ThinkPHP = window.Think = {
			"ROOT": "", //当前网站地址
			"APP": "/index.php?s=", //当前项目地址
			"PUBLIC": "/Public", //项目公共目录地址
			"DEEP": "/", //PATHINFO分割符
			"MODEL": ["3", "1", "html"],
			"VAR": ["m", "c", "a"]
		}
	})();
</script>
<script type="text/javascript" src="/static/think.js"></script>
<script type="text/javascript" src="/static/admin/js/common.js"></script>
<script type="text/javascript">
	+function () {
		var $window = $(window), $subnav = $("#subnav"), url;
		$window.resize(function () {
			$("#main").css("min-height", $window.height() - 130);
		}).resize();

		/* 左边菜单高亮 */
		url = window.location.pathname + window.location.search;
		url = url.replace(".html", "")
				.replace(/(\/(p)\/\d+)|(&p=\d+)|(\/(id)\/\d+)|(&id=\d+)/, "");
		$subnav.find("a[href^='" + url + "']").parent().addClass("current");

		/* 左边菜单显示收起 */
		$("#subnav").on("click", "h3", function () {
			var $this = $(this);
			$this.find(".icon").toggleClass("icon-fold");
			$this.next().slideToggle("fast").siblings(".side-sub-menu:visible").prev("h3").find("i").addClass("icon-fold").end().end().hide();
		});

		$("#subnav h3 a").click(function (e) {
			e.stopPropagation()
		});

		/* 头部管理员菜单 */
		$(".user-bar").mouseenter(function () {
			var userMenu = $(this).children(".user-menu ");
			userMenu.removeClass("hidden");
			clearTimeout(userMenu.data("timeout"));
		}).mouseleave(function () {
			var userMenu = $(this).children(".user-menu");
			userMenu.data("timeout") && clearTimeout(userMenu.data("timeout"));
			userMenu.data("timeout", setTimeout(function () {
				userMenu.addClass("hidden")
			}, 100));
		});

		/* 表单获取焦点变色 */
		$("form").on("focus", "input", function () {
			$(this).addClass('focus');
		}).on("blur", "input", function () {
			$(this).removeClass('focus');
		});
		$("form").on("focus", "textarea", function () {
			$(this).closest('label').addClass('focus');
		}).on("blur", "textarea", function () {
			$(this).closest('label').removeClass('focus');
		});

		// 导航栏超出窗口高度后的模拟滚动条
		var sHeight = $(".sidebar").height();
		var subHeight = $(".subnav").height();
		var diff = subHeight - sHeight; //250
		var sub = $(".subnav");
		if (diff > 0) {
			$(window).mousewheel(function (event, delta) {
				if (delta > 0) {
					if (parseInt(sub.css('marginTop')) > -10) {
						sub.css('marginTop', '0px');
					} else {
						sub.css('marginTop', '+=' + 10);
					}
				} else {
					if (parseInt(sub.css('marginTop')) < '-' + (diff - 10)) {
						sub.css('marginTop', '-' + (diff - 10));
					} else {
						sub.css('marginTop', '-=' + 10);
					}
				}
			});
		}
	}();
</script>

<script type="text/javascript">
	Think.setValue("allow_publish", 1);
	Think.setValue("check", 0);
	Think.setValue("model[]", null || [1]);
	Think.setValue("type[]", null || [2]);
	Think.setValue("display", 1);
	Think.setValue("reply", 0);
	Think.setValue("reply_model[]", null || [1]);
	Think.setValue("reply_type[]", null || [2]);
	$(function () {
		showTab();
		$("input[name=reply]").change(function () {
			var $reply = $(".form-item.reply");
			parseInt(this.value) ? $reply.show() : $reply.hide();
		}).filter(":checked").change();
	});
	//导航高亮
	$('.side-sub-menu').find('a[href="/index.php?s=/admin/category/index.html"]').closest('li').addClass('current');
</script>

</body>
</html>
